#
# @lc app=leetcode.cn id=83 lang=python3
#
# [83] 删除排序链表中的重复元素
#

# @lc code=start
# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:
    def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]:
        dummy=ListNode()
        current = dummy
        temp = -200
        while head:
            if temp != head.val:
                current.next = head
                current = current.next
                temp = head.val
            else:
                current.next = None
            head = head.next
        return dummy.next
            

# @lc code=end

